//-----------------------------------------------------------------------
// <copyright file="ProductSellService.cs" company="FetCo">
//     Copyright (c) FetCo. All rights reserved.
// </copyright>
//-----------------------------------------------------------------------	

using System;
using System.Collections;
using FetCo.Framework;
using ADESSA.Entities;
using ADESSA.Data;
    
namespace ADESSA.Business
{   
	/// <summary>
	/// 
	/// </summary> 
    public class ProductSellService
    {
        #region ProductSell

        public static void CreateProductSell(ProductSell productSell)
        {            
            try
            {
                ProductSellDAO productSellDAO = new ProductSellDAO();
                productSellDAO.CreateProductSell(productSell);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessCreateProductSellException, ex);
            }
        }        

        public static void UpdateProductSell(ProductSell productSell)
        {            
            try
            {
                ProductSellDAO productSellDAO = new ProductSellDAO();
                productSellDAO.UpdateProductSell(productSell);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessUpdateProductSellException, ex);
            }
        }        

        public static void DeleteProductSell(long productId)
        {            
            try
            {
                ProductSellDAO productSellDAO = new ProductSellDAO();
                productSellDAO.DeleteProductSell(productId);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessDeleteProductSellException, ex);
            }
        }
        
        public static ProductSell GetProductSell(long productId)
        {            
            try
            {
                ProductSellDAO productSellDAO = new ProductSellDAO();
                return productSellDAO.GetProductSell(productId);                
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductSellException, ex);
            }
        }                

        public static ProductSellCollection GetProductSellList(ProductSellColumns orderBy, OrderDirection orderDirection)
        {            
            try
            {
                ProductSellDAO productSellDAO = new ProductSellDAO();
                return productSellDAO.GetProductSellList(orderBy, orderDirection);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductSellListException, ex);
            }
        }        

        public static ProductSellCollection GetProductSellList(ProductSellColumns orderBy, OrderDirection orderDirection, int page, int pageSize, out int totalRecords)
        {            
            try
            {
                ProductSellDAO productSellDAO = new ProductSellDAO();
                return productSellDAO.GetProductSellList(orderBy, orderDirection, page, pageSize, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductSellListException, ex);
            }
        }        

	    public static ProductSellCollection GetProductSellListByParam(object orderBy, OrderDirection orderDirection,string where)
        {            
            try
            {
                ProductSellDAO productSellDAO = new ProductSellDAO();
                return productSellDAO.GetProductSellListByParam(orderBy, orderDirection,where);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductSellListException, ex);
            }
        }        

        public static ProductSellCollection GetProductSellListByParam(object orderBy, OrderDirection orderDirection, int page, int pageSize,string Criteria, out int totalRecords)
        {            
            try
            {
                ProductSellDAO productSellDAO = new ProductSellDAO();
                return productSellDAO.GetProductSellListByParam(orderBy, orderDirection, page, pageSize,Criteria, out totalRecords);
            }
            catch (BusinessException)
            {
                throw;
            }
            catch (Exception ex)
            {
                // log this exception
                Logger.Error(ex);
                // wrap it and rethrow
                throw new BusinessException(SR.BusinessGetProductSellListException, ex);
            }
        }        

        #endregion
    }
}